package com.lvy.hczn.front.business.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lvy.hczn.front.system.domain.business.OutboundOrderDetail;
import com.lvy.hczn.front.business.dto.OutboundOrderDetailDto;
import com.lvy.hczn.front.business.mapper.OutboundOrderDetailMapper;
import com.lvy.hczn.front.business.service.OutboundOrderDetailService;
import com.lvy.hczn.front.common.exception.UtilException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class OutboundOrderDetailServiceImpl extends ServiceImpl<OutboundOrderDetailMapper, OutboundOrderDetail> implements OutboundOrderDetailService {

    @Autowired
    private OutboundOrderDetailMapper outboundOrderDetailMapper;

    /**
     * 出库统计
     *
     * @param outboundOrderCode
     * @return
     * @author yw
     * @date 2022-04-07 13:03:42
     */
    @Override
    public List<OutboundOrderDetailDto> outboundCount(String outboundOrderCode) throws Exception {
        if (StrUtil.isEmpty(outboundOrderCode)) {
            throw new UtilException("出库单为空");
        }
        return outboundOrderDetailMapper.outboundCount(outboundOrderCode);
    }
}
